<template>
  <div class="confirm-order-wrap" v-if="showConfirmBox">
    <div class="confirm-order-bg"></div>
    <div class="confirm-order-main">
      <div class="order-main-tile">支付确认</div>
      <div class="content-txt">
        <p>{{ confrimTxt }}</p>
      </div>
      <div class="button-wrap">
        <button class="btnitem cancel-btn" @click.stop="checkPayResult">
          取消
        </button>
        <button class="btnitem confim-btn" @click.stop="checkPayResult">
          已完成支付
        </button>
      </div>
    </div>
  </div>
</template>

<script>
import ConfirmBoxDialog from "./index";

export default {
  data() {
    return {
      showConfirmBox: false,
      confrimTxt:
        "如果您已支付成功，请点击‘‘已完成支付’’按钮，反之则点击‘‘取消’’",
    };
  },
  methods: {
    changeshowConfirmBox(val) {
      this.showConfirmBox = val;
    },
    checkPayResult() {
      new ConfirmBoxDialog().checkOrderState(() => this.changeshowConfirmBox(false));
    },
  },
};
</script>

<style lang="scss" scoped>
.confirm-order-wrap {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 21;

  .confirm-order-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
  }

  .confirm-order-main {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 5.9rem;
    height: auto;
    min-height: 3rem;
    border-radius: 0.08rem;
    background-color: #fff;
  }

  .order-main-tile {
    font-size: 0.36rem;
    color: #000;
    line-height: 0.5rem;
    text-align: center;
    padding: 0.64rem 0 0.32rem 0;
  }

  .content-txt {
    font-size: 0.3rem;
    padding: 0 0.46rem;
    color: #888;
    line-height: 0.42rem;

    p {
      margin-bottom: 0.24rem;
    }
  }

  .content-txt p:last-child {
    margin: 0;
  }

  .button-wrap {
    width: 100%;
    padding: 0 0.48rem;
    box-sizing: border-box;
    display: flex;
    justify-content: space-between;
    margin: 0.48rem 0;

    .btnitem {
      display: inline-block;
      height: 0.8rem;
      border-radius: 0.4rem;
      user-select: none;
      background-color: transparent;
      font-size: 0.36rem;
      outline: none;
      cursor: pointer;
    }

    .cancel-btn {
      width: 1.58rem;
      color: #333;
      background-color: #eee;
    }

    .confim-btn {
      width: 2.96rem;
      color: #fff;
      background-color: #105cfb;
    }
  }
}
</style>